package com.zzsy.carosshopprojects.network;

import android.content.Context;
import android.util.Log;

import com.google.gson.Gson;
import com.zzsy.carosshopprojects.base.DoHandoverCzBean;
import com.zzsy.carosshopprojects.bean.ActivityBean;
import com.zzsy.carosshopprojects.bean.BaseBean;
import com.zzsy.carosshopprojects.bean.CarCardBean;
import com.zzsy.carosshopprojects.bean.CardZBBean;
import com.zzsy.carosshopprojects.bean.ChangeShiftsBean;
import com.zzsy.carosshopprojects.bean.ConfigBean;
import com.zzsy.carosshopprojects.bean.CouponListBean;
import com.zzsy.carosshopprojects.bean.CreateFuCardBean;
import com.zzsy.carosshopprojects.bean.CreateOrderBean;
import com.zzsy.carosshopprojects.bean.CreateRechargeOrderBean;
import com.zzsy.carosshopprojects.bean.DoHandoverBean;
import com.zzsy.carosshopprojects.bean.GetMainCardBean;
import com.zzsy.carosshopprojects.bean.GetOilsListBean;
import com.zzsy.carosshopprojects.bean.HomeContentBean;
import com.zzsy.carosshopprojects.bean.LoginBean;
import com.zzsy.carosshopprojects.bean.MainCardListBean;
import com.zzsy.carosshopprojects.bean.MemberInfoBean;
import com.zzsy.carosshopprojects.bean.OrderBean;
import com.zzsy.carosshopprojects.bean.OrderDetialBean;
import com.zzsy.carosshopprojects.bean.OrderListBean;
import com.zzsy.carosshopprojects.bean.OrderZongBean;
import com.zzsy.carosshopprojects.bean.ReceiptBean;
import com.zzsy.carosshopprojects.bean.RechargeOrderDetialBean;
import com.zzsy.carosshopprojects.bean.RedPageBean;
import com.zzsy.carosshopprojects.bean.RefundPasswordBean;
import com.zzsy.carosshopprojects.bean.ReghterOrderBean;
import com.zzsy.carosshopprojects.bean.ServiceCardBean;
import com.zzsy.carosshopprojects.network.Utils.MyObserver;
import com.zzsy.carosshopprojects.network.Utils.RetrofitUtils;
import com.zzsy.carosshopprojects.network.Utils.RxHelper;
import com.zzsy.carosshopprojects.util.DataUtil;
import com.zzsy.carosshopprojects.util.md5.Md5Util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * 提交参数方式
 */
public class RequestUtils {
    public static final MediaType JSON = MediaType
            .parse("application/json; charset=utf-8");

    /**
     * 登录
     *
     * @param context
     * @param username
     * @param password
     * @param cid
     * @param observer
     */
    public static void Login(Context context, String username, String password, String cid, MyObserver<LoginBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("username", username.trim());
        map.put("password", Md5Util.md5Hex(password));
        map.put("cid", cid);
        RetrofitUtils.getApiUrl()
                .postLogin(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 修改打印二维码开关
     *
     * @param context
     * @param qrSwitch
     * @param userId
     * @param observer
     */
    public static void UpdateQrSwitch(Context context, String qrSwitch, String userId, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("qrSwitch", qrSwitch);
        map.put("userId", userId);
        RetrofitUtils.getApiUrl()
                .postUpdateQrSwitch(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取首页数据
     *
     * @param context
     * @param terminalId
     * @param observer
     */
    public static void HomeContent(Context context, String terminalId, MyObserver<HomeContentBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        RetrofitUtils.getApiUrl()
                .postHomeContent(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 加油员消费交接班列表
     *
     * @param context
     * @param page
     * @param terminalId
     * @param storeId
     * @param observer
     */
    public static void HandoverList(Context context, String page, String terminalId, String storeId, MyObserver<ChangeShiftsBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("pageSize", "10");
        map.put("terminalId", terminalId);
        map.put("storeId", storeId);
        String json = new Gson().toJson(map);
        RequestBody body = RequestBody.create(JSON, json);
        RetrofitUtils.getApiUrl()
                .postHandoverList(body).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 吧台交接班列表
     *
     * @param context
     * @param page
     * @param terminalId
     * @param storeId
     * @param observer
     */
    public static void RechargeHandoverList(Context context, String page, String terminalId, String storeId, MyObserver<ChangeShiftsBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("pageSize", "10");
        map.put("terminalId", terminalId);
        map.put("storeId", storeId);
        String json = new Gson().toJson(map);
        RequestBody body = RequestBody.create(JSON, json);
        RetrofitUtils.getApiUrl()
                .postRechargeHandoverList(body).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 操作员交接班
     *
     * @param context
     * @param terminalId
     * @param observer
     */
    public static void DoHandover(Context context, String terminalId, String storeId, MyObserver<List<DoHandoverCzBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        map.put("storeId", storeId);
        RetrofitUtils.getApiUrl()
                .postDoHandover(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 吧台交接班操作员
     *
     * @param context
     * @param terminalId
     * @param storeId
     * @param observer
     */
    public static void DoRechargeHandover(Context context, String terminalId, String storeId, MyObserver<DoHandoverBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        map.put("storeId", storeId);
        RetrofitUtils.getApiUrl()
                .postDoRechargeHandover(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取油站未打印订单小票
     *
     * @param context
     * @param terminalId
     * @param observer
     */
    public static void IsHaveTicketPrint(Context context, String terminalId, MyObserver<List<OrderListBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        RetrofitUtils.getApiUrl()
                .postIsHaveTicketPrint(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 查询订单小票是否可以打印
     *
     * @param context
     * @param orderNumber
     * @param observer
     */
    public static void UpdatePrintStatus(Context context, String orderNumber, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNumber", orderNumber);
        RetrofitUtils.getApiUrl()
                .postUpdatePrintStatus(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取门店下油品列表
     *
     * @param context
     * @param storeId
     * @param observer
     */
    public static void OilListByStoreId(Context context, String storeId, MyObserver<List<GetOilsListBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        RetrofitUtils.getApiUrl()
                .postOilListByStoreId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取幂等性校验token
     *
     * @param context
     * @param observer
     */
    public static void getToken(Context context, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        RetrofitUtils.getApiUrl()
                .postToken(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 创建加油订单或者会员消费订单
     *
     * @param context
     * @param map
     * @param observer
     */
    public static void CreateOrder(Context context, Map<String, String> map, MyObserver<CreateOrderBean> observer) {
        Log.d("xxxxxx", map.toString() + "");
        RetrofitUtils.getApiUrl()
                .postCreateOrder(map, map.get("idempotenceToken")).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 加油订单签名
     *
     * @param context
     * @param map
     * @param observer
     */
    public static void OrderPay(Context context, Map<String, String> map, String token, MyObserver<BaseBean> observer) {
        RetrofitUtils.getApiUrl()
                .postOrderPay(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 订单详情
     *
     * @param context
     * @param orderNumber
     * @param observer
     */
    public static void OrderDetail(Context context, String orderNumber, MyObserver<OrderDetialBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNumber", orderNumber);
        RetrofitUtils.getApiUrl()
                .postOrderDetail(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 判断银联支付方式
     *
     * @param context
     * @param storeId
     * @param observer
     */
    public static void BankPayChannel(Context context, String storeId, String type, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        map.put("type", type);
        RetrofitUtils.getApiUrl()
                .postBankPayChannel(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 充值成功修改订单状态
     *
     * @param context
     * @param orderNumber
     * @param bankPayNum
     * @param observer
     */
    public static void UpdateRecheargeOrderStatus(Context context, String orderNumber, String bankPayNum, String feePayType, String payDate, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNumber", orderNumber);
        map.put("bankPayNum", bankPayNum);
        map.put("feePayType", feePayType);
        map.put("payDate", payDate);
        RetrofitUtils.getApiUrl()
                .postUpdateRecheargeOrderStatus(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 银行卡修改消费订单状态
     *
     * @param context
     * @param bankPayNum
     * @param orderNumber
     * @param orderStatus
     * @param payStatus
     * @param observer
     */
    public static void UpdateOrderStatus(Context context, String bankPayNum, String orderNumber, String orderStatus, String payStatus, String feePayType, String payDate, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("bankPayNum", bankPayNum);
        map.put("orderNumber", orderNumber);
        map.put("orderStatus", orderStatus);
        map.put("payStatus", payStatus);
        map.put("feePayType", feePayType);
        map.put("payDate", payDate);

        RetrofitUtils.getApiUrl()
                .postUpdateOrderStatus(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据UUID查询会员信息
     *
     * @param context
     * @param uuid
     * @param companyId
     * @param observer
     */
    public static void MemberByUuid(Context context, String uuid, String companyId, MyObserver<MemberInfoBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("uuid", uuid);
        map.put("companyId", companyId);
        RetrofitUtils.getApiUrl()
                .postMemberByUuid(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 开具发票接口
     *
     * @param context
     * @param orderNums
     * @param tokens
     * @param observer
     */
    public static void DrawBill(Context context, String orderNums, String tokens, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNums", orderNums);
        RetrofitUtils.getApiUrl()
                .postDrawBill(map, tokens).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 会员消费的油品列表
     *
     * @param context
     * @param storeId
     * @param productId
     * @param observer
     */
    public static void OilListByStoreIdAndProductId(Context context, String storeId, String productId, MyObserver<List<GetOilsListBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        map.put("productId", productId);
        RetrofitUtils.getApiUrl()
                .postOilListByStoreIdAndProductId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取门店满减折扣活动
     *
     * @param context
     * @param map
     * @param observer
     */
    public static void GetActivity(Context context, Map<String, String> map, MyObserver<List<ActivityBean>> observer) {
        RetrofitUtils.getApiUrl()
                .postGetActivity(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取红包列表
     *
     * @param context
     * @param storeId
     * @param memberId
     * @param productId
     * @param memberCardId
     * @param observer
     */
    public static void MemberRedPackedList(Context context, String storeId, String memberId, String productId, String memberCardId, MyObserver<List<RedPageBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        map.put("productId", productId);
        map.put("memberId", memberId);
        map.put("memberCardId", memberCardId);
        RetrofitUtils.getApiUrl()
                .postMemberRedPackedList(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 余额支付
     *
     * @param context
     * @param map
     * @param tokens
     * @param observer
     */
    public static void BalancePay(Context context, Map<String, String> map, String tokens, MyObserver<BaseBean> observer) {
        Log.d("AAAAAAAAAA", map.toString());
        RetrofitUtils.getApiUrl()
                .postBalancePay(map, tokens).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 取消消费订单
     *
     * @param context
     * @param orderNumber
     * @param observer
     */
    public static void CancelOrder(Context context, String orderNumber, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNumber", orderNumber);
        RetrofitUtils.getApiUrl()
                .postCancelOrder(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 小程序一件加油二维码生成
     *
     * @param context
     * @param sceneStr
     * @param observer
     */
    public static void GetMiniQr(Context context, String sceneStr, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("sceneStr", sceneStr);
        Log.d("xxxsssxx", map.toString());
        RetrofitUtils.getApiUrl()
                .postGetMiniQr(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 快捷加油
     * @param context
     * @param sceneStr
     * @param observer
     */
    public static void GeQuickJoinOilQr(Context context, String sceneStr, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("sceneStr", sceneStr);
        Log.d("xxxsssxx", map.toString());
        RetrofitUtils.getApiUrl()
                .postGetQuickJoinQr(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取服务卡种类
     *
     * @param context
     * @param storeId
     * @param observer
     */
    public static void ServiceCardList(Context context, String storeId, MyObserver<List<ServiceCardBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        RetrofitUtils.getApiUrl()
                .postServiceCardList(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 创建小票洗车卡
     *
     * @param context
     * @param companyId
     * @param serviceCardId
     * @param storeId
     * @param terminalId
     * @param observer
     */
    public static void CreateWashCarCard(Context context, String companyId, String serviceCardId, String storeId, String terminalId, MyObserver<CarCardBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("companyId", companyId);
        map.put("serviceCardId", serviceCardId);
        map.put("storeId", storeId);
        map.put("terminalId", terminalId);
        RetrofitUtils.getApiUrl()
                .postCreateWashCarCard(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 本班次的订单列表
     *
     * @param context
     * @param page
     * @param terminalId
     * @param observer
     */
    public static void OrdersByTerminalId(Context context, String page, String terminalId, MyObserver<OrderBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("page", page);
        map.put("pageSize", "10");
        map.put("terminalId", terminalId);
        RetrofitUtils.getApiUrl()
                .postOrdersByTerminalId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取本班各支付类型支付的金额
     *
     * @param context
     * @param terminalId
     * @param observer
     */
    public static void ShiftStatisticsByTerminalId(Context context, String terminalId, MyObserver<OrderZongBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        RetrofitUtils.getApiUrl()
                .postShiftStatisticsByTerminalId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取卡号
     *
     * @param context
     * @param storeId
     * @param uuid
     * @param observer
     */
    public static void CarPreparation(Context context, String storeId, String uuid, MyObserver<CardZBBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        map.put("uuid", uuid);
        RetrofitUtils.getApiUrl()
                .postCarPreparation(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 会员开卡
     *
     * @param context
     * @param map
     * @param tokens
     * @param observer
     */
    public static void CreateMainCard(Context context, Map<String, String> map, String tokens, MyObserver<BaseBean> observer) {
        RetrofitUtils.getApiUrl()
                .postCreateMainCard(map, tokens).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取验证码接口
     *
     * @param context
     * @param phone
     * @param observer
     */
    public static void GetCode(Context context, String phone, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        RetrofitUtils.getApiUrl()
                .postGetCode(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 验证手机号以及验证妈
     *
     * @param context
     * @param phone
     * @param msgId
     * @param code
     * @param observer
     */
    public static void CheckCode(Context context, String phone, String msgId, String code, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("msgId", msgId);
        map.put("code", code);
        RetrofitUtils.getApiUrl()
                .postCheckCode(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据电话号获取主卡信息
     *
     * @param context
     * @param companyId
     * @param phone
     * @param observer
     */
    public static void MyMainCardsByPhone(Context context, String companyId, String phone, MyObserver<MainCardListBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("companyId", companyId);
        map.put("phone", phone);
        RetrofitUtils.getApiUrl()
                .postMyMainCardsByPhone(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 实体卡挂失
     *
     * @param context
     * @param cardId
     * @param uuid
     * @param observer
     */
    public static void UpdateCardByUuid(Context context, String cardId, String uuid, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardId", cardId);
        map.put("uuid", uuid);
        RetrofitUtils.getApiUrl()
                .postUpdateCardByUuid(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据主卡uuid获取下发的副卡
     *
     * @param context
     * @param companyId
     * @param uuid
     * @param observer
     */
    public static void MemberSubCardsByUuid(Context context, String companyId, String uuid, MyObserver<GetMainCardBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("companyId", companyId);
        map.put("uuid", uuid);
        RetrofitUtils.getApiUrl()
                .postMemberSubCardsByUuid(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 解绑副卡
     *
     * @param context
     * @param cardId
     * @param observer
     */
    public static void UntyingCard(Context context, String cardId, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardId", cardId);
        RetrofitUtils.getApiUrl()
                .postUntyingCard(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 挂失副卡操作
     *
     * @param context
     * @param cardId
     * @param observer
     */
    public static void LossCard(Context context, String cardId, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardId", cardId);
        RetrofitUtils.getApiUrl()
                .postLossCard(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 修改副卡额度
     *
     * @param context
     * @param cardId
     * @param payLimitAmount
     * @param observer
     */
    public static void UpdateCardQuota(Context context, String cardId, String payLimitAmount, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardId", cardId);
        map.put("payLimitAmount", payLimitAmount);
        RetrofitUtils.getApiUrl()
                .postUpdateCardQuota(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据主卡信息获取开副卡列表
     *
     * @param context
     * @param cardId
     * @param observer
     */
    public static void SubCardTypeListByCardId(Context context, String cardId, MyObserver<List<CreateFuCardBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardId", cardId);
        RetrofitUtils.getApiUrl()
                .postSubCardTypeListByCardId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 开副卡
     *
     * @param context
     * @param map
     * @param observer
     */
    public static void CreateSubCard(Context context, Map<String, String> map, String token, MyObserver<BaseBean> observer) {
        RetrofitUtils.getApiUrl()
                .postCreateSubCard(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 充值活动接口
     *
     * @param context
     * @param map
     * @param observer
     */
    public static void RechargeActivity(Context context, Map<String, String> map, MyObserver<List<ActivityBean>> observer) {
        RetrofitUtils.getApiUrl()
                .postRechargeActivity(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 创建充值订单
     *
     * @param context
     * @param map
     * @param token
     * @param observer
     */
    public static void CreateRechargeOrder(Context context, Map<String, String> map, String token, MyObserver<CreateRechargeOrderBean> observer) {
        RetrofitUtils.getApiUrl()
                .postCreateRechargeOrder(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 查询充值订单详情
     *
     * @param context
     * @param orderNumber
     * @param observer
     */
    public static void GetROrder(Context context, String orderNumber, MyObserver<RechargeOrderDetialBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderNumber", orderNumber);
        RetrofitUtils.getApiUrl()
                .postGetROrder(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据电话号获取主卡信息
     *
     * @param context
     * @param companyId
     * @param phone
     * @param observer
     */
    public static void GetMyMainCardsByPhone(Context context, String companyId, String phone, MyObserver<MainCardListBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("companyId", companyId);
        map.put("phone", phone);
        RetrofitUtils.getApiUrl()
                .postGetMyMainCardsByPhone(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取该会员下的费油优惠券
     *
     * @param context
     * @param memberId
     * @param observer
     */
    public static void GetMemberCouponList(Context context, String memberId, MyObserver<CouponListBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("page", "1");
        map.put("pageSize", "100");
        map.put("memberId", memberId);
        map.put("productId", "3");
        map.put("payType", "");
        RetrofitUtils.getApiUrl()
                .postGetMemberCouponList(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 非油优惠券核销
     *
     * @param context
     * @param map
     * @param token
     * @param observer
     */
    public static void UseNonOilCoupon(Context context, Map<String, String> map, String token, MyObserver<BaseBean> observer) {
        RetrofitUtils.getApiUrl()
                .postUseNonOilCoupon(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 扣除积分接口
     *
     * @param context
     * @param phone
     * @param integral
     * @param observer
     */
    public static void IntegralPay(Context context, String phone, String integral, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("integral", integral);
        RetrofitUtils.getApiUrl()
                .postIntegralPay(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 解绑实体卡
     *
     * @param context
     * @param uuid
     * @param observer
     */
    public static void DeleteCard(Context context, String uuid, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("uuid", uuid);
        RetrofitUtils.getApiUrl()
                .postDeleteCard(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 获取红包列表
     *
     * @param context
     * @param storeId
     * @param memberId
     * @param productId
     * @param memberCardId
     * @param observer
     */
    public static void GetMemberRedPackedList(Context context, String storeId, String memberId, String productId, String memberCardId, MyObserver<List<RedPageBean>> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        map.put("memberId", memberId);
        map.put("productId", productId);
        map.put("memberCardId", memberCardId);
        RetrofitUtils.getApiUrl()
                .postGetMemberRedPackedList(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 删除优惠券接口
     *
     * @param context
     * @param couponIds
     * @param observer
     */
    public static void DeleteCoupon(Context context, String couponIds, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("couponIds", couponIds);
        RetrofitUtils.getApiUrl()
                .postDeleteCoupon(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 根据uuid查询可开加油订单列表
     *
     * @param context
     * @param cardType
     * @param timeOutStatus
     * @param uuid
     * @param observer
     */
    public static void GetUnInvoiceOrdersByUuid(Context context, String cardType, String timeOutStatus, String uuid, MyObserver<ReceiptBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("cardType", cardType);
        map.put("timeOutStatus", timeOutStatus);
        map.put("uuid", uuid);
        map.put("storeId", DataUtil.getInstance().getStoreId());
        RetrofitUtils.getApiUrl()
                .postGetUnInvoiceOrdersByUuid(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 自定义发票金额接口
     *
     * @param context
     * @param amount
     * @param companyId
     * @param uuid
     * @param token
     * @param observer
     */
    public static void DrawBillByCustomAmount(Context context, String amount, String companyId, String uuid, String token, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("amount", amount);
        map.put("companyId", companyId);
        map.put("uuid", uuid);
        RetrofitUtils.getApiUrl()
                .postDrawBillByCustomAmount(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 本班次充值列表
     *
     * @param context
     * @param terminalId
     * @param page
     * @param observer
     */
    public static void GetOrdersByTerminalId(Context context, String terminalId, String page, MyObserver<ReghterOrderBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("terminalId", terminalId);
        map.put("page", page);
        map.put("pageSize", "10");
        Log.d("xxxxxaaa", map.toString());
        RetrofitUtils.getApiUrl()
                .postROrdersByTerminalId(map).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * cofing接口
     *
     * @param context
     * @param observer
     */
    public static void getConfig(Context context, MyObserver<ConfigBean> observer) {
        RetrofitUtils.getApiUrl()
                .postConfig().compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 手持终端退款
     * @param context
     * @param orderId
     * @param orderNumber
     * @param token
     * @param observer
     */
    public static void RefundOrder(Context context, String orderId, String orderNumber,String token, MyObserver<BaseBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("orderId", orderId);
        map.put("orderNumber", orderNumber);
        RetrofitUtils.getApiUrl()
                .postRefundOrder(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }

    /**
     * 退款密码验证
     * @param context
     * @param storeId
     * @param token
     * @param observer
     */
    public static void VerificationPwd(Context context, String storeId,String token, MyObserver<RefundPasswordBean> observer) {
        Map<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        RetrofitUtils.getApiUrl()
                .postVerificationPwd(map, token).compose(RxHelper.observableIO2Main(context))
                .subscribe(observer);
    }
}



